<template>
  <el-drawer
    title="文章编辑"
    :direction="direction"
    :before-close="handleClose"
    v-model="visibilityBinding"
    size="55%"
  >
    <div class="form-drawer">
      <el-row>
        <el-col :span="24">
          <span class="demonstration">文章分类：</span>
          <el-select v-model="value" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-col>
      </el-row>
      <el-row style="margin-top: 20px">
        <el-col :span="24">
          <span style="width: 100px" class="demonstration">文章名称：</span>
          <el-input
            placeholder="请填写文章名称"
            v-model="input2"
            class="form-search-input"
          >
          </el-input>
        </el-col>
      </el-row>

      <el-row style="margin-top: 20px">
        <el-col :span="24">
          <span style="margin-right: 15px" class="demonstration">关键词：</span>
          <el-input
            placeholder="请填写关键词"
            v-model="input2"
            class="form-search-input"
          >
          </el-input>
        </el-col>
      </el-row>

      <el-row style="margin-top: 20px">
        <el-col :span="24">
          <div class="block">
            <span class="demonstration">时间日期：</span>
            <el-date-picker
              v-model="value1"
              disabled="true"
              type="monthrange"
              range-separator="至"
              start-placeholder="开始月份"
              end-placeholder="结束月份"
            >
            </el-date-picker>
          </div>
        </el-col>
      </el-row>

      <!-- 富文本编辑器 -->
      <el-row style="margin-top: 20px">
        <div style="margin: 20px 0">文章内容：</div>
        <wangEditor></wangEditor>
      </el-row>
      <el-row style="margin-top: 20px">
        <el-button type="warning" @click="handleEdit(scope.$index, scope.row)">
          重置
        </el-button>
        <el-button
          type="primary"
          style="margin-left: 20px"
          @click="handleEdit(scope.$index, scope.row)"
        >
          提交
        </el-button>
      </el-row>
    </div>
  </el-drawer>
</template>

<script setup>
import wangEditor from '@/components/wangEditor/index'

const props = defineProps(['visibilityBinding'])

const emits = defineEmits(['handleCloseEmits'])

const handleClose = (visibilityBinding) => {
  visibilityBinding = false
  emits('handleCloseEmits', visibilityBinding)
}
</script>

<style lang="scss" scoped>
#form {
  padding: 20px;
}
.head {
  margin: 20px 0;
}
.form-search {
  display: flex;
  align-content: center;
  justify-content: right;
}
.form-search-input {
  text-align: right;
  width: 200px;
}
.form-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 20px auto;
}
.edit {
  padding: 20px 0;
}
.form-drawer {
  padding: 20px;
}
</style>
